public class Student extends Person{

    //定义新成员属性
    long number;                       //学号
    double phi, eng, comp;             //哲学phi、英语eng、计算机comp


    // 构造函数-继承父类name、sex、age
    public Student(long number, String name, char sex, int age, double phi, double eng, double comp) {
        super(name, sex, age);       //super调用父类变量
        this.number = number;
        this.phi = phi;
        this.eng = eng;
        this.comp = comp;
    }

    // 新增方法：求三门课最高分
    public double max() {
        double max = phi;
        if (eng > max) max = eng;
        if (comp > max) max = comp;
        return max;
    }

    // 覆盖父类toString方法-返回学号、姓名、性别、最高分
    @Override
    public String toString() {
        return "学号：" + number + "，" + super.toString() + "，最高分：" + max();
    }
}
